"use strict";

;(function () {
  var userAgent = window.navigator.userAgent;
  var ios = !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  var timeout;

  if (ios) {
    window.document.body.addEventListener('focusin', function () {
      window.clearTimeout(timeout);
    });
    window.document.body.addEventListener('focusout', function () {
      window.clearTimeout(timeout);
      timeout = window.setTimeout(function () {
        window.scrollTo({
          top: 0,
          left: 0,
          behavior: 'smooth'
        });
      }, 0);
    });
  }
})();